#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, vector<int>> mp;
    for(int i = 0; i < n; i++) cin >> a[i], mp[a[i]].push_back(i);
    int ans = 0, l, r;
    int xx = 0;
    for(auto [k, arr] : mp) {
        int ans1, l1, r1;
        ans1 = k;
        l1 = arr[0], r1 = arr[0];
        int l2 = l1;
        int pre = 0, sum = 0, t = arr[0];
        // for(auto x : arr) cout << x << ' ';
        // cout << endl;
        for(auto x : arr) {
            pre++;
            pre -= (x - t);
            t = x + 1;
            if(pre <= 0) {
                pre = 1;
                l2 = x;
            }
            if(pre > sum) {
                l1 = l2;
                r1 = x;
                sum = pre;
            } 
        }   
        // cout << sum << ' ' << l1 <<' ' << r1 << endl;
        if(sum > xx) {
            xx = sum;
            ans = ans1;
            l = l1, r = r1;
        }
    }
    cout << ans << ' ' << l + 1<< ' ' << r + 1 << endl;
}

signed main() {
    int t = 1;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}